import React ,{useState,useEffect} from "react"
import {useLocation,useHistory} from "react-router-dom"
// import 
const ChangeName:React.FC = ()=>{
    let [names,setNames] = useState(Object)
    let loc = useLocation()
    let his = useHistory()
    let namesa = loc.state
    useEffect(()=>{
        setNames(namesa)
    },[])
    function onName(){
        console.log(names)
        his.push("/index/my")
    }
    return <div>
        <input type="text" value={names&&names.nickname}/>
        <button onClick={onName}>确认修改</button>
    </div>
}

export default ChangeName